// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
let hotSearchUrl = '/ebapi/store_api/hot_search';
let indexUrl = '/ebapi/public_api/index';
let loginUrl = '/auth/appLogin';
let customerGetArrayUrl = '/api/customer/getArray';
let getByBillNoUrl = '/wms/mobile/api/getByBillNo';
let getReceiptArrayUrl = '/wms/mobile/api/getReceiptArray';
let getStockPalaceUrl = '/wms/mobile/api/getStockPalace';
let billInSaveBatchUrl = '/wms/mobile/api/billInSaveBatch';
let getDetailInventorysUrl = '/wms/mobile/api/getDetailInventorys';
let getOnShelfMaterialUrl = '/wms/mobile/api/getOnShelfMaterial';
let goodsDownBatchUrl = '/wms/mobile/api/goodsDownBatch';
let queryOffShelfMaterialUrl = '/wms/mobile/api/queryOffShelfMaterial';
let goodsUpBatchUrl = '/wms/mobile/api/goodsUpBatch';
let inventoryTransferUrl = '/wms/mobile/api/inventoryTransfer';
let getByReturnNoUrl = '/wms/mobile/api/getByReturnNo';
let billOutSaveBatchUrl = '/wms/mobile/api/billOutSaveBatch';
let getByPickNoUrl = '/wms/mobile/api/getByPickNo';
let passwordConfirmUrl = '/wms/mobile/api/passwordConfirm';
let getByPickNoForFactoryUrl = '/wms/mobile/api/getByPickNoForFactory';
let updateFactoryMaterialUrl = '/wms/mobile/api/updateFactoryMaterial';

let getByOutPickNoUrl = '/wms/mobile/api/getByOutPickNo';
let getByOutNoUrl = '/wms/mobile/api/getByOutNo';
let getMaxBatchNoUrl = '/wms/mobile/api/getMaxBatchNo';
let saveSplitDataUrl = '/wms/mobile/api/saveSplitData';

let getByTaskCodeUrl = '/wms/mobile/api/getByTaskCode';
let getInventoryPlansUrl = '/wms/mobile/api/getInventoryPlans';

let stockPalaceInfoByInventoryPlanUrl = '/wms/mobile/api/stockPalaceInfoByInventoryPlan';
let getOnShelfMaterialPlanUrl = '/wms/mobile/api/getOnShelfMaterialPlan';
let updateInventoryPlanBillUrl = '/wms/mobile/api/updateInventoryPlanBill';


// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处没有使用传入的params参数
	let getSearch = (params = {}) => vm.$u.get(hotSearchUrl, {
		id: 2
	});
	// 此处使用了传入的params参数，一切自定义即可
	let getInfo = (params = {}) => vm.$u.post(indexUrl, params);

	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	// 登录
	let login = (params = {}) => vm.$u.post(loginUrl, params);
	// 枚举类型
	let enumName = (params = {}) => vm.$u.post(enumNameUrl, params);

// 外购入库
let getByBillNo = (params = {}) => vm.$u.post(getByBillNoUrl, params);
let getReceiptArray = (params = {}) => vm.$u.get(getReceiptArrayUrl, params);
let getStockPalace = (params = {}) => vm.$u.get(getStockPalaceUrl, params);
let billInSaveBatch = (params = {}) => vm.$u.post(billInSaveBatchUrl, params);
// 库存查询
let getDetailInventorys = (params = {}) => vm.$u.post(getDetailInventorysUrl, params);
// 货物下架
let getOnShelfMaterial = (params = {}) => vm.$u.get(getOnShelfMaterialUrl, params);
let goodsDownBatch = (params = {}) => vm.$u.post(goodsDownBatchUrl, params);
// 货物上架
let queryOffShelfMaterial = (params = {}) => vm.$u.get(queryOffShelfMaterialUrl, params);
let goodsUpBatch = (params = {}) => vm.$u.post(goodsUpBatchUrl, params);
// 移库调拨
let inventoryTransfer = (params = {}) => vm.$u.post(inventoryTransferUrl, params);
// 外购退库
let getByReturnNo = (params = {}) => vm.$u.post(getByReturnNoUrl, params);
let billOutSaveBatch = (params = {}) => vm.$u.post(billOutSaveBatchUrl, params);
// 下架退库

// 生产捡料
let getByPickNo = (params = {}) => vm.$u.post(getByPickNoUrl, params);
let passwordConfirm = (params = {}) => vm.$u.post(passwordConfirmUrl, params);
// 车间收料
let getByPickNoForFactory = (params = {}) => vm.$u.post(getByPickNoForFactoryUrl, params);
let updateFactoryMaterial = (params = {}) => vm.$u.post(updateFactoryMaterialUrl, params);

// 委外捡料
let getByOutPickNo = (params = {}) => vm.$u.post(getByOutPickNoUrl, params);

// 成品拣货
let getByOutNo = (params = {}) => vm.$u.post(getByOutNoUrl, params);
// 批次拆分
let getMaxBatchNo = (params = {}) => vm.$u.post(getMaxBatchNoUrl, params);
let saveSplitData = (params = {}) => vm.$u.post(saveSplitDataUrl, params);

// 产品入库
let getByTaskCode = (params = {}) => vm.$u.post(getByTaskCodeUrl, params);
// 盘点
let getInventoryPlans = (params = {}) => vm.$u.get(getInventoryPlansUrl, params);
let stockPalaceInfoByInventoryPlan = (params = {}) => vm.$u.post(stockPalaceInfoByInventoryPlanUrl, params);
let getOnShelfMaterialPlan = (params = {}) => vm.$u.get(getOnShelfMaterialPlanUrl, params);
let updateInventoryPlanBill = (params = {}) => vm.$u.post(updateInventoryPlanBillUrl, params);

	vm.$u.api = {
		updateInventoryPlanBill,
		getOnShelfMaterialPlan,
		stockPalaceInfoByInventoryPlan,
		getInventoryPlans,
		getByTaskCode,
		saveSplitData,
		getMaxBatchNo,
		getSearch,
		getInfo,
		login,
		enumName,
		getByBillNo,
		getReceiptArray,
		getStockPalace,
		billInSaveBatch,
		getDetailInventorys,
		getOnShelfMaterial,
		goodsDownBatch,
		queryOffShelfMaterial,
		goodsUpBatch,
		inventoryTransfer,
		getByReturnNo,
		billOutSaveBatch,
		getByPickNo,
		passwordConfirm,
		getByPickNoForFactory,
		updateFactoryMaterial,
		getByOutPickNo,
		getByOutNo
	};
}

export default {
	install
}
